package com.itheima.weirpc.loadbalancer;

import com.itheima.weirpc.spi.SpiLoader;

/**
 * ClassName: LoadBalancerFactory
 * Package: com.itheima.weirpc.loadbalancer.LoadBalancer
 * Description:
 *
 * @Author 看到风
 * @Create 2024/12/13 11:15
 * @Version 1.0
 */
public class LoadBalancerFactory {

    static {
        SpiLoader.load(LoadBalancer.class);
    }

    /**
     * 默认负载均衡器
     */
    private static final LoadBalancer DEFAULT_LOAD_BALANCER = new RoundRobinLoadBalancer();

    /**
     * 获取实例
     *
     * @param key
     * @return
     */
    public static LoadBalancer getInstance(String key) {
        return SpiLoader.getInstance(LoadBalancer.class, key);
    }

}

